package com.mike.employment.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mike.employment.base.ApiResult;
import com.mike.employment.base.PageRequest;
import com.mike.employment.po.Offer;
import com.mike.employment.service.OfferService;

@RestController
@RequestMapping("/api/offer")
public class OfferController {

	@Autowired
	private OfferService offerService;

	@PostMapping("/page")
	public ApiResult page(@RequestBody PageRequest req) {
		return ApiResult.success(offerService.getPage(req));
	}
	
	@PutMapping()
	public ApiResult saveOrUpdate(@RequestBody Offer offer) {
		return ApiResult.success(offerService.saveOrUpdate(offer));
	}
	
}
